import {createHmac} from "node:crypto";

/**
 * 加密字符串
 * @param text  待加密文本
 * @param secretKey 密钥
 */
export function hmacEncode(text:string,secretKey:string) {
    const hmac = createHmac("sha512",secretKey);
    const update = hmac.update(text);
    return Buffer.from(update.digest()).toString("base64");
}